//
//  ComposeMenuButton.swift
//  weibobbaj
//
//  Created by Tiffany宝 on 16/4/25.
//  Copyright © 2016年 Tiffany. All rights reserved.
//

import UIKit

class ComposeMenuButton: UIButton {
    
    //重写按钮的 highlighted ,使其点击不变高亮
    override var highlighted: Bool{
        get{
            
            return false
        }
        
        set{
            
        }
    }
    
    override init(frame: CGRect) {
        
        super.init(frame: frame)
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        
//        backgroundColor = UIColor.darkGrayColor()
        imageView?.contentMode = .Center
        titleLabel?.textAlignment = .Center
    }

    override func layoutSubviews() {
        
        super.layoutSubviews()
        
        let ComposeMenuButtonW: CGFloat = self.frame.width
        let ComposeMenuButtonH: CGFloat = self.frame.height
        
        imageView?.frame = CGRectMake(0, 0, ComposeMenuButtonW, ComposeMenuButtonW)
        
        titleLabel?.frame = CGRectMake(0, ComposeMenuButtonW, ComposeMenuButtonW,ComposeMenuButtonH - ComposeMenuButtonW)
    }
}
